import java.awt.*;
import java.awt.image.BufferedImage;

// 墙壁类
public class Wall extends GameObject {
    public enum WallType { BRICK, STEEL, WATER }
    
    private WallType type;
    private BufferedImage wallImage;
    
    public Wall(int x, int y, int width, int height, WallType type) {
        super(x, y, width, height);
        this.type = type;
        
        // 根据墙壁类型加载图片
        switch(type) {
            case BRICK:
                wallImage = ImageManager.getImage("brick.jpg");
                break;
            case STEEL:
                wallImage = ImageManager.getImage("steel.jpg");
                break;
            case WATER:
                wallImage = ImageManager.getImage("water.jpg");
                break;
        }
    }
    
    public void update() {
        // 墙壁不需要更新
    }
    
    public void draw(Graphics g) {
        if (wallImage != null) {
            g.drawImage(wallImage, x, y, width, height, null);
        } else {
            // 如果没有图片，使用颜色代替
            switch(type) {
                case BRICK:
                    g.setColor(new Color(139, 69, 19));
                    break;
                case STEEL:
                    g.setColor(new Color(128, 128, 128));
                    break;
                case WATER:
                    g.setColor(new Color(0, 0, 255, 128));
                    break;
            }
            g.fillRect(x, y, width, height);
        }
    }
    
    public WallType getType() {
        return type;
    }
    
    public boolean isDestroyable() {
        return type == WallType.BRICK;
    }
}
